Getting A Complete Translation

Sometimes CTools™ does not completely translate a file with the CTools™ Pascal to C function.  Errors in getting a complete output can be worked around.  If you run Pascal to C, scroll down the output window to the bottom.  If there are no translation errors you will see “.“ there.  If not, there was an abnormal termination of the translation due to something CTools™ is not yet made able to handle.

Abnormal terminations are caused by:
(1) More than 32 variables being assigned to one type declaration.

Solution:  Split them up.
(2) An array declared with a byte range (i.e. “0..255”), including the
        “packed” Pascal keyword.

Solution:  Change it before translating.
(3) Any wrong Pascal source, such as seen in a "Rascal" file, such as void procedures which have parens, or some such.

Solution:  Correct them.
(4) It seems to balk at the word “Implementation”.

Solution: Comment it out.

If an abnormal termination has happened, simply:

(1 ) Note WHERE in the Pascal file the translation stopped.
(2 ) CLOSE AND DO NOT SAVE the translation.
(3 ) Scroll down the open, original Pascal window to that place.
(4 ) Comment out or otherwise correct the erring line.
(5 ) Attempt another complete translation.
(6a) If complete, save and close the translation.
(6b) If incomplete, repeat steps 2 through 6.
(7 ) Close and do not save the original Pascal file.

Another form of incomplete translation, where it does not abnormally terminate, yet does not properly translate, are when the word “packed” is read in a type definition.

So, before you even try to translate the file, to save time and trouble, it would be wise to pre-edit the Pascal file (a copy) and remove all occurrences of the word “packed” and change any range variables to the Pascal version of what they will end up being (i.e. change “0..255” to “integer”).